package com.yc.cloud.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yc.cloud.entity.HwCameraSnapshotStrategy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

/**
 * <p>
 * 摄像头抓图策略表 Mapper 接口
 * </p>
 *
 * @author kinggu
 * @since 2025-10-10
 */
@Mapper
public interface HwCameraSnapshotStrategyMapper extends BaseMapper<HwCameraSnapshotStrategy> {

    /**
     * 获取全局默认策略
     */
    default HwCameraSnapshotStrategy selectGlobalDefault() {
        return this.selectOne(
            new QueryWrapper<HwCameraSnapshotStrategy>()
                .eq(HwCameraSnapshotStrategy.GlobalDefault, true)
                .eq(HwCameraSnapshotStrategy.Status, true)
                .eq(HwCameraSnapshotStrategy.Deleted, false)
                .last("LIMIT 1")
        );
    }
} 